// controller
Ext.regController("Upload", {
    index:function(){
        this.listPanel = this.render({
                xtype: "gallery-upload"
        });
        
        Ext.getCmp("topBar").remove("share-pix");
        Ext.getCmp("topBar").insert(0,{
            ui: 'back',
            id: "back-share",
            text: 'Back',
            iconMask: true,
            handler: function(){
                Ext.getCmp("topBar").remove("back-share");
                Ext.getCmp("topBar").insert(0,{
                    title:"Share",
                    id:"share-pix",
                    iconCls:"compose",
                    iconMask: true,
                    cls: "upload",
                    handler:function(){
                        Ext.redirect("Upload/index");
                    }
                });
                Ext.getCmp("topBar").doLayout();
                Ext.redirect("Login/index");
            }
        });
        Ext.getCmp("topBar").doLayout();
        /*Ext.getCmp("topBar").remove("back-share");
        Ext.getCmp("topBar").insert(0,{
            title:"Share",
            id:"share-pix",
            iconCls:"compose",
            iconMask: true,
            cls: "upload",
            handler:function(){
                Ext.redirect("Upload/index");
            }
        });
        Ext.getCmp("topBar").doLayout();*/
        Gallery.viewport.setActiveItem(this.listPanel);
    }
});
